/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lintulaskenta.utils;

import lintulaskenta.utils.SelectionInterface._SelectionOption;

import java.util.Collection;

/**
 * A structure representing a HTML <select></select> -element.
 */
public interface SelectionInterface extends Iterable<_SelectionOption> {

	/**
	 * A structure representing a HTML <option></option> -element of a <select></select> -element.
	 */
	public static interface _SelectionOption {

		/**
		 * Option value; <option value="">
		 * @return
		 */
		public String getValue();

		/**
		 * Option description text; <option>text</option>
		 * @return
		 */
		public String getText();

	}

	/**
	 * List of options
	 * @see _SelectionOption
	 * @return
	 */
	public Collection<_SelectionOption> getOptions();

	/**
	 * Get option's description by it's value
	 * @param optionValue
	 * @return description
	 */
	public String get(String optionValue) throws IllegalArgumentException;

	/**
	 * Tells if this selection defines the given value
	 * @param optionValue
	 * @return true if value exists, false if not
	 */
	public boolean containsOption(String optionValue);

	/**
	 * Name of the selection.
	 * @return
	 */
	public String getName();

}
